﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using iLangl.BusinessModel.Managers;
using iLangl.Languages;
using iLangl.Model;

namespace iLangl.Tests.InitialDataFixture
{
	[TestClass]
	public class LanguageRegistrationTest
	{
		[TestMethod]
		public void LanguageRegistration()
		{
			LanguageManager.Instance.RegisterLanguages(LanguagesISO693_3.GetLanguages());

			Assert.AreEqual(LanguagesISO693_3.GetLanguages().Count, LanguageManager.Instance.GetLanguages().Count);
		}

		[TestMethod]
		public void TestCustomerPluginLanguageRegistration()
		{
			List<PluginLanguage> languages = new List<PluginLanguage>();

			PluginLanguage pl = new PluginLanguage();
			pl.PluginCode = "1";
			pl.PluginName = "English";
			pl.PluginId = PluginRegistrationTest.iLanglTestCustomerPlugin;
			pl.LanguageId = "eng";
			languages.Add(pl);


			pl = new PluginLanguage();
			pl.PluginCode = "2";
			pl.PluginName = "Russian";
			pl.PluginId = PluginRegistrationTest.iLanglTestCustomerPlugin;
			pl.LanguageId = "rus";
			languages.Add(pl);


		
			LanguageManager.Instance.RegisterPluginLanguages(languages);

			Language lang = LanguageManager.Instance.GetLanguage(PluginRegistrationTest.iLanglTestCustomerPlugin, "1");
			Assert.AreEqual(lang.LanguageId, "eng");

			lang = LanguageManager.Instance.GetLanguage(PluginRegistrationTest.iLanglTestCustomerPlugin, "2");
			Assert.AreEqual(lang.LanguageId, "rus");
		}
	}
}
